package com.acg.auth.controller;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.acg.auth.pojo.SysLoginLog;
import com.acg.auth.service.SysLoginLogService;
import com.acg.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 系统访问记录 前端控制器
 * </p>
 *
 * @author togogo
 * @since 2025-08-01
 */
@RestController
@RequestMapping("/acg/login-log")
@CrossOrigin("*")
public class SysLoginLogController {


    @Autowired
    private SysLoginLogService service;


    /**
     * 用户条件分页查询
     * @return
     */
    @GetMapping("/getPage/{page}/{limit}")
    public Result getPage(@PathVariable Long page,
                          @PathVariable Long limit) {
        // 1、分页条件
        Page<SysLoginLog> ipage = new Page<>(page, limit);

        // 2、条件构造
        LambdaQueryWrapper<SysLoginLog> lwq = new LambdaQueryWrapper<>();

        lwq.orderByDesc(SysLoginLog::getCreateTime);

        // 2 分页查询
        Page<SysLoginLog> paged = service.page(ipage,lwq);
        return Result.ok(paged);
    }



}

